s1 = input('Введите набор скобок: ')  .replace(" ","")
s =''
for a in s1:
    if a == "(" or a == ")" or a == "[" or a == "]" or a == "{" or a == "}" or a == "<" or a == ">":
        s += a
while "()" in s or"[]" in s or "<>" in s:
    s = s.replace("()", "")
    s = s.replace("{}", "")
    s = s.replace("[]", "")
    s = s.replace("<>", "")
    if s:
        print(False)
    else:
        print(True)
